<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html>
<head>

	<title></title>
	<script type="text/javascript" charset="utf-8" src="/shop/wwwroot/Public/ueditor/ueditor.config.js"></script>
    <script type="text/javascript" charset="utf-8" src="/shop/wwwroot/Public/ueditor/ueditor.all.min.js"> </script>
    <!--建议手动加在语言，避免在ie下有时因为加载语言失败导致编辑器加载失败-->
    <!--这里加载的语言文件会覆盖你在配置项目里添加的语言类型，比如你在配置项目里配置的是英文，这里加载的中文，那最后就是中文-->
    <script type="text/javascript" charset="utf-8" src="/shop/wwwroot/Public/ueditor/lang/zh-cn/zh-cn.js"></script>
    <script type="text/javascript" src="/shop/wwwroot/Public/jquery-3.3.1/jquery-3.3.1.min.js"></script>

</head>
<body>

<p align="center">
	<h2>商品修改页</h2>
	<a href="index.html">商品主页</a>
</p>
<form action="../goods/add" enctype="multipart/form-data" method="post">
	<input type="hidden" name="id" value="<?php echo ($info["id"]); ?>">
	商品名称：<input type="text" name="goods_name" value="<?php echo ($info["goods_name"]); ?>">
		<span style="color:red;">*</span>
	<br />
	商品货号：<input type="text" name="goods_sn" value="<?php echo ($info["goods_sn"]); ?>">
	<span style="color:#ccc;">货号可以不填,由系统自动分配</span>
	<br />
	商品分类：<select name="cate_id">
				<option>请选择商品分类</option>
				<?php if(is_array($cate_data)): $i = 0; $__LIST__ = $cate_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vo["id"]); ?>" <?php if(($info["cate_id"]) == $vo["id"]): ?>selected="selected"<?php endif; ?>>
						|<?php echo (str_repeat("--",$vo["lev"])); echo ($vo["c_name"]); ?>
					</option><?php endforeach; endif; else: echo "" ;endif; ?>
			</select>
			<span style="color:red;">*</span>
	<br />
	<p id="p">
	扩展分类：<input type="button" value="添加扩展分类" id="container_add">
			<?php if(is_array($goods_cate)): $i = 0; $__LIST__ = $goods_cate;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><select name="cate_ext[]" id="cate_ext">
					<option value="0">请选择商品分类</option>
					<?php if(is_array($cate_data)): $i = 0; $__LIST__ = $cate_data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vos): $mod = ($i % 2 );++$i;?><option value="<?php echo ($vos["id"]); ?>" <?php if(($vo["cate_id"]) == $vos["id"]): ?>selected="selected"<?php endif; ?>>
							|<?php echo (str_repeat("--",$vos["lev"])); echo ($vos["c_name"]); ?>
						</option><?php endforeach; endif; else: echo "" ;endif; ?>
				</select><?php endforeach; endif; else: echo "" ;endif; ?>
	</p>
	市场价格：<input type="text" name="market_price" value="<?php echo ($info["market_price"]); ?>">
	<span style="color:red;">*</span>
	<br />
	本店价格：<input type="text" name="shop_price" value="<?php echo ($info["shop_price"]); ?>">
	<span style="color:red;">*</span>
	<br />
	是否上架：<input type="radio" name="is_sale" value="1" <?php if(($info["is_sale"]) == "1"): ?>checked="checked"<?php endif; ?>>是
			 <input type="radio" name="is_sale" value="0" <?php if(($info["is_sale"]) == "0"): ?>checked="checked"<?php endif; ?>>否
	<br />
	选择属性：
			<input type="checkbox" name="is_hot" value="1" <?php if(($info["is_hot"]) == "1"): ?>checked="checked"<?php endif; ?>>推荐
			<input type="checkbox" name="is_rec" value="1" <?php if(($info["is_rec"]) == "1"): ?>checked="checked"<?php endif; ?>>热卖
			<input type="checkbox" name="is_new" value="1" <?php if(($info["is_new"]) == "1"): ?>checked="checked"<?php endif; ?>>新品
	<br />
	商品图片：<input type="file" name="goods_img"><span style="color:red;">*</span>
	<br />

	<!-- 加载编辑器的容器 -->
    
    <script id="container" name="goods_body" type="text/plain" style="width:1024px;height:400px;">
    <?php echo ($info["goods_body"]); ?>
	</script>
	<br />
	<input type="submit" name="提交">
	<input type="reset" name="重置">
</form>
<!-- 实例化编辑器 -->
<script type="text/javascript">
    var ue = UE.getEditor('container');
    $(document).ready(function(){
    	$("#container_add").click(function(){
    		//alert(231);
    		var newSelect = $("#cate_ext").clone(true);
    		// alert(newSelect);
    		$("#p").append(newSelect);
    	});
    });
</script>

</body>
</html>